<%@ include file="../common/top.jsp" %>
<script type="text/javascript">
    //刷新验证码
    function changeImg(){
        document.getElementById("validateCodeImg").src="helpDrawValidateCode?t=" + Math.random();
    }

    // 获取当前页面的 URL
    const currentURL = window.location.href;
    // 将当前页面的 URL 存储到 Session
    sessionStorage.setItem('redirectURL', currentURL);
</script>
<div id="Catalog">
    <form action="loginForm" method="post">
        <p>Please enter your username and password.</p>
        <c:if test="${requestScope.signOnMsg != null}">
            <p> <font color="red">${requestScope.signOnMsg} </font> </p>
        </c:if>
        <p>
            <c:if test="${sessionScope.account == null}">
                Username:<input type="text" name="username" value="j2ee"> <br />
                Password:<input type="password" name="password" value="123"><br/>
                Captcha:<input type="text" name="validateCode" style="width:50px">
                <img alt="看不清？换一张" src="helpDrawValidateCode" id="validateCodeImg" onclick="changeImg()">
            </c:if>
            <c:if test="${sessionScope.account!= null}">
                Username:<input type="text" name="username" value="${sessionScope.account.username}"><br />
                Password:<input type="password" name="password" value="${sessionScope.account.password}"><br/>
                Captcha:<input type="text" name="validateCode" style="width:50px">
                <img alt="看不清？换一张" src="helpDrawValidateCode" id="validateCodeImg" onclick="changeImg()">
            </c:if>

        </p>
        <input type="submit" value="Login">
    </form>
    Need a user name and password?
    <a href="registerForm">Register Now!</a>
</div>

<%@ include file="../common/bottom.jsp" %>

